<?php
if(!defined('RSMSINC'))
{
	exit("Request Error!");
}
function lib_misc(&$ctag,&$refObj)
{
	global $dsql,$envs,$cfg_ml;
	
	//属性处理
	$attlist="row|12,titlelen|24,type|,para|";
	FillAttsDefault($ctag->CAttribute->Items,$attlist);
	extract($ctag->CAttribute->Items, EXTR_SKIP);
	$revalue = '';
	
	//你需编写的代码，不能用echo之类语法，把最终返回值传给$revalue
	//------------------------------------------------------
          if ($type=='dateweek')
		  {
		  	  $week=array(0=>"日", "一", "二", "三", "四", "五", "六");
              $revalue = strftime("%Y")."年".strftime("%m")."月".strftime("%d")."日 星期".$week[strftime("%w")];
		  } elseif ($type=='date') {
		  	  $revalue = strftime("%Y")."年".strftime("%m")."月".strftime("%d")."日";
		  }
          elseif ($type=='logintimes')
          {
              $count = $dsql->GetOne("Select count(*) as dd From `#@__loginlog` where username='".$cfg_ml->M_LoginID."'");
			  $tcount = array();
			  if ($cfg_ml->M_LoginID == "chinjo" || $cfg_ml->M_LoginID == "wangshumin")
			  {
			  	$tcount = $dsql->GetOne("Select count(*) as tt From `#@__loginlog`");
              	$revalue = $count['dd']."次 共 ".$tcount['tt']." ";
			  } else {
			  	$revalue = $count['dd'];
			  }
          } elseif ($type=='getpinyin')
		  {
		  	if (!empty($para))
				$revalue = GetPinyin ($para);
		  } elseif ($type=='username')
		  {
		  	$revalue = $cfg_ml->M_UserName;
		  }
	//------------------------------------------------------
	return $revalue;
}
?>